<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../vue@3.2.23.js"></script>
	</head>
	<body>
		<div id="app">
			根计数器{{count}}
			<parent :count="count" @bgcg="bgcg"></parent>
		</div>
	</body>
</html>
<script>
	const parent={
		props:['count'],
		//事件声明
		emits:['bgcg'],
		methods:{
			cg(){
				//事件传递
				this.$emit('bgcg',this.count+1,this.count+2)
			}
		},
		template:`
				<div v-bind="this.$attrs">{{count}}</div>
				<button @click="cg">改变count</button>
			`
	}
	const app=Vue.createApp({
		components:{
			parent
		},
		methods:{
			bgcg(v1,v2){
				this.count++
				console.log(v1,v2)
			}
		},
		data() {
			return{
				count:1
			}
		}
	})
	app.mount('#app')
</script>